<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QItemDelegate Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QItemDelegate Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QItemDelegate class provides display and editing facilities
for data items from a model. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a>.</p><p>Inherited by <a href="qsqlrelationaldelegate.html">QSqlRelationalDelegate</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qitemdelegate.html#QItemDelegate">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QWidget <b><a href="qitemdelegate.html#createEditor">createEditor</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>, QStyleOptionViewItem&#160;<i>option</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#drawBackground">drawBackground</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionViewItem&#160;<i>option</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#drawCheck">drawCheck</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionViewItem&#160;<i>option</i>, QRect&#160;<i>rect</i>, Qt.CheckState&#160;<i>state</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#drawDecoration">drawDecoration</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionViewItem&#160;<i>option</i>, QRect&#160;<i>rect</i>, QPixmap&#160;<i>pixmap</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#drawDisplay">drawDisplay</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionViewItem&#160;<i>option</i>, QRect&#160;<i>rect</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#drawFocus">drawFocus</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionViewItem&#160;<i>option</i>, QRect&#160;<i>rect</i>)</li><li><div class="fn" />bool <b><a href="qitemdelegate.html#editorEvent">editorEvent</a></b> (<i>self</i>, QEvent&#160;<i>event</i>, QAbstractItemModel&#160;<i>model</i>, QStyleOptionViewItem&#160;<i>option</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />bool <b><a href="qitemdelegate.html#eventFilter">eventFilter</a></b> (<i>self</i>, QObject&#160;<i>object</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" />bool <b><a href="qitemdelegate.html#hasClipping">hasClipping</a></b> (<i>self</i>)</li><li><div class="fn" />QItemEditorFactory <b><a href="qitemdelegate.html#itemEditorFactory">itemEditorFactory</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#paint">paint</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionViewItem&#160;<i>option</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#setClipping">setClipping</a></b> (<i>self</i>, bool&#160;<i>clip</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#setEditorData">setEditorData</a></b> (<i>self</i>, QWidget&#160;<i>editor</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#setItemEditorFactory">setItemEditorFactory</a></b> (<i>self</i>, QItemEditorFactory&#160;<i>factory</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#setModelData">setModelData</a></b> (<i>self</i>, QWidget&#160;<i>editor</i>, QAbstractItemModel&#160;<i>model</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />QSize <b><a href="qitemdelegate.html#sizeHint">sizeHint</a></b> (<i>self</i>, QStyleOptionViewItem&#160;<i>option</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qitemdelegate.html#updateEditorGeometry">updateEditorGeometry</a></b> (<i>self</i>, QWidget&#160;<i>editor</i>, QStyleOptionViewItem&#160;<i>option</i>, QModelIndex&#160;<i>index</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QItemDelegate class provides display and editing facilities
for data items from a model.</p>
<p>QItemDelegate can be used to provide custom display features and
editor widgets for item views based on <a href="qabstractitemview.html">QAbstractItemView</a> subclasses. Using a
delegate for this purpose allows the display and editing mechanisms
to be customized and developed independently from the model and
view.</p>
<p>The QItemDelegate class is one of the <a href="model-view.html">Model/View Classes</a> and is part of Qt's
<a href="model-view-programming.html">model/view framework</a>.
Note that <a href="qstyleditemdelegate.html">QStyledItemDelegate</a> has taken over
the job of drawing Qt's item views. We recommend the use of
<a href="qstyleditemdelegate.html">QStyledItemDelegate</a> when
creating new delegates.</p>
<p>When displaying items from a custom model in a standard view, it
is often sufficient to simply ensure that the model returns
appropriate data for each of the <a href="qt.html#ItemDataRole-enum">roles</a> that determine the appearance
of items in views. The default delegate used by Qt's standard views
uses this role information to display items in most of the common
forms expected by users. However, it is sometimes necessary to have
even more control over the appearance of items than the default
delegate can provide.</p>
<p>This class provides default implementations of the functions for
painting item data in a view and editing data from item models.
Default implementations of the <a href="qitemdelegate.html#paint">paint</a>() and <a href="qitemdelegate.html#sizeHint">sizeHint</a>() virtual functions,
defined in <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a>, are
provided to ensure that the delegate implements the correct basic
behavior expected by views. You can reimplement these functions in
subclasses to customize the appearance of items.</p>
<p>When editing data in an item view, QItemDelegate provides an
editor widget, which is a widget that is placed on top of the view
while editing takes place. Editors are created with a <a href="qitemeditorfactory.html">QItemEditorFactory</a>; a default static
instance provided by <a href="qitemeditorfactory.html">QItemEditorFactory</a> is installed on
all item delegates. You can set a custom factory using <a href="qitemdelegate.html#setItemEditorFactory">setItemEditorFactory</a>()
or set a new default factory with <a href="qitemeditorfactory.html#setDefaultFactory">QItemEditorFactory.setDefaultFactory</a>().
It is the data stored in the item model with the <a href="qt.html#ItemDataRole-enum">Qt.EditRole</a> that is edited.</p>
<p>Only the standard editing functions for widget-based delegates
are reimplemented here:</p>
<ul>
<li><a href="qitemdelegate.html#createEditor">createEditor</a>()
returns the widget used to change data from the model and can be
reimplemented to customize editing behavior.</li>
<li><a href="qitemdelegate.html#setEditorData">setEditorData</a>()
provides the widget with data to manipulate.</li>
<li><a href="qitemdelegate.html#updateEditorGeometry">updateEditorGeometry</a>()
ensures that the editor is displayed correctly with respect to the
item view.</li>
<li><a href="qitemdelegate.html#setModelData">setModelData</a>()
returns updated data to the model.</li>
</ul>
<p>The <a href="qabstractitemdelegate.html#closeEditor">closeEditor</a>() signal
indicates that the user has completed editing the data, and that
the editor widget can be destroyed.</p>
<a id="standard-roles-and-data-types" name="standard-roles-and-data-types" />
<h3>Standard Roles and Data Types</h3>
<p>The default delegate used by the standard views supplied with Qt
associates each standard role (defined by <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>) with certain data
types. Models that return data in these types can influence the
appearance of the delegate as described in the following table.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Role</th>
<th>Accepted Types</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.BackgroundRole</a></td>
<td><a href="qbrush.html">QBrush</a></td>
</tr>
<tr class="even" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.BackgroundColorRole</a></td>
<td><a href="qcolor.html">QColor</a> (obsolete; use <a href="qt.html#ItemDataRole-enum">Qt.BackgroundRole</a> instead)</td>
</tr>
<tr class="odd" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.CheckStateRole</a></td>
<td><a href="qt.html#CheckState-enum">Qt.CheckState</a></td>
</tr>
<tr class="even" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.DecorationRole</a></td>
<td><a href="qicon.html">QIcon</a>, <a href="qpixmap.html">QPixmap</a> and <a href="qcolor.html">QColor</a></td>
</tr>
<tr class="odd" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a></td>
<td><a href="qstring.html">QString</a> and types with a string
representation</td>
</tr>
<tr class="even" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.EditRole</a></td>
<td>See <a href="qitemeditorfactory.html">QItemEditorFactory</a>
for details</td>
</tr>
<tr class="odd" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.FontRole</a></td>
<td><a href="qfont.html">QFont</a></td>
</tr>
<tr class="even" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.SizeHintRole</a></td>
<td><a href="qsize.html">QSize</a></td>
</tr>
<tr class="odd" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.TextAlignmentRole</a></td>
<td><a href="qt.html#AlignmentFlag-enum">Qt.Alignment</a></td>
</tr>
<tr class="even" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.ForegroundRole</a></td>
<td><a href="qbrush.html">QBrush</a></td>
</tr>
<tr class="odd" valign="top">
<td><a href="qt.html#ItemDataRole-enum">Qt.TextColorRole</a></td>
<td><a href="qcolor.html">QColor</a> (obsolete; use <a href="qt.html#ItemDataRole-enum">Qt.ForegroundRole</a> instead)</td>
</tr>
</table>
<p>If the default delegate does not allow the level of
customization that you need, either for display purposes or for
editing data, it is possible to subclass QItemDelegate to implement
the desired behavior.</p>
<a id="subclassing" name="subclassing" />
<h3>Subclassing</h3>
<p>When subclassing QItemDelegate to create a delegate that
displays items using a custom renderer, it is important to ensure
that the delegate can render items suitably for all the required
states; e.g. selected, disabled, checked. The documentation for the
<a href="qitemdelegate.html#paint">paint</a>() function contains
some hints to show how this can be achieved.</p>
<p>You can provide custom editors by using a <a href="qitemeditorfactory.html">QItemEditorFactory</a>. The <a href="itemviews-coloreditorfactory.html">Color Editor Factory
Example</a> shows how a custom editor can be made available to
delegates with the default item editor factory. This way, there is
no need to subclass QItemDelegate. An alternative is to reimplement
<a href="qitemdelegate.html#createEditor">createEditor</a>(),
<a href="qitemdelegate.html#setEditorData">setEditorData</a>(),
<a href="qitemdelegate.html#setModelData">setModelData</a>(), and
<a href="qitemdelegate.html#updateEditorGeometry">updateEditorGeometry</a>().
This process is described in the <a href="itemviews-spinboxdelegate.html">Spin Box Delegate Example</a>.</p>
<a id="qstyleditemdelegate-vs-qitemdelegate" name="qstyleditemdelegate-vs-qitemdelegate" />
<h3>QStyledItemDelegate vs. QItemDelegate</h3>
<p>Since Qt 4.4, there are two delegate classes: QItemDelegate and
<a href="qstyleditemdelegate.html">QStyledItemDelegate</a>.
However, the default delegate is <a href="qstyleditemdelegate.html">QStyledItemDelegate</a>. These two
classes are independent alternatives to painting and providing
editors for items in views. The difference between them is that
<a href="qstyleditemdelegate.html">QStyledItemDelegate</a> uses the
current style to paint its items. We therefore recommend using
<a href="qstyleditemdelegate.html">QStyledItemDelegate</a> as the
base class when implementing custom delegates or when working with
Qt style sheets. The code required for either class should be equal
unless the custom delegate needs to use the style for drawing.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QItemDelegate" />QItemDelegate.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an item delegate with the given <i>parent</i>.</p>


<h3 class="fn"><a name="createEditor" /><a href="qwidget.html">QWidget</a> QItemDelegate.createEditor (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Reimplemented from <a href="qabstractitemdelegate.html#createEditor">QAbstractItemDelegate.createEditor</a>().</p>
<p>Returns the widget used to edit the item specified by
<i>index</i> for editing. The <i>parent</i> widget and style
<i>option</i> are used to control how the editor widget
appears.</p>
<p><b>See also</b> <a href="qabstractitemdelegate.html#createEditor">QAbstractItemDelegate.createEditor</a>().</p>


<h3 class="fn"><a name="drawBackground" />QItemDelegate.drawBackground (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Renders the item background for the given <i>index</i>, using
the given <i>painter</i> and style <i>option</i>.</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="drawCheck" />QItemDelegate.drawCheck (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, <a href="qt.html#CheckState-enum">Qt.CheckState</a>&#160;<i>state</i>)</h3><p>Renders a check indicator within the rectangle specified by
<i>rect</i>, using the given <i>painter</i> and style
<i>option</i>, using the given <i>state</i>.</p>


<h3 class="fn"><a name="drawDecoration" />QItemDelegate.drawDecoration (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>)</h3><p>Renders the decoration <i>pixmap</i> within the rectangle
specified by <i>rect</i> using the given <i>painter</i> and style
<i>option</i>.</p>


<h3 class="fn"><a name="drawDisplay" />QItemDelegate.drawDisplay (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, QString&#160;<i>text</i>)</h3><p>Renders the item view <i>text</i> within the rectangle specified
by <i>rect</i> using the given <i>painter</i> and style
<i>option</i>.</p>


<h3 class="fn"><a name="drawFocus" />QItemDelegate.drawFocus (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>)</h3><p>Renders the region within the rectangle specified by
<i>rect</i>, indicating that it has the focus, using the given
<i>painter</i> and style <i>option</i>.</p>


<h3 class="fn"><a name="editorEvent" />bool QItemDelegate.editorEvent (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>&#160;<i>model</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemdelegate.html#editorEvent">QAbstractItemDelegate.editorEvent</a>().</p>


<h3 class="fn"><a name="eventFilter" />bool QItemDelegate.eventFilter (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>object</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qobject.html#eventFilter">QObject.eventFilter</a>().</p>
<p>Returns true if the given <i>editor</i> is a valid <a href="qwidget.html">QWidget</a> and the given <i>event</i> is handled;
otherwise returns false. The following key press events are handled
by default:</p>
<ul>
<li><b>Tab</b></li>
<li><b>Backtab</b></li>
<li><b>Enter</b></li>
<li><b>Return</b></li>
<li><b>Esc</b></li>
</ul>
<p>In the case of <b>Tab</b>, <b>Backtab</b>, <b>Enter</b> and
<b>Return</b> key press events, the <i>editor</i>'s data is
comitted to the model and the editor is closed. If the <i>event</i>
is a <b>Tab</b> key press the view will open an editor on the next
item in the view. Likewise, if the <i>event</i> is a <b>Backtab</b>
key press the view will open an editor on the <i>previous</i> item
in the view.</p>
<p>If the event is a <b>Esc</b> key press event, the <i>editor</i>
is closed <i>without</i> committing its data.</p>
<p><b>See also</b> <a href="qabstractitemdelegate.html#commitData">commitData</a>() and
<a href="qabstractitemdelegate.html#closeEditor">closeEditor</a>().</p>


<h3 class="fn"><a name="hasClipping" />bool QItemDelegate.hasClipping (<i>self</i>)</h3><h3 class="fn"><a name="itemEditorFactory" /><a href="qitemeditorfactory.html">QItemEditorFactory</a> QItemDelegate.itemEditorFactory (<i>self</i>)</h3><p>Returns the editor factory used by the item delegate. If no
editor factory is set, the function will return null.</p>
<p><b>See also</b> <a href="qitemdelegate.html#setItemEditorFactory">setItemEditorFactory</a>().</p>


<h3 class="fn"><a name="paint" />QItemDelegate.paint (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemdelegate.html#paint">QAbstractItemDelegate.paint</a>().</p>
<p>Renders the delegate using the given <i>painter</i> and style
<i>option</i> for the item specified by <i>index</i>.</p>
<p>When reimplementing this function in a subclass, you should
update the area held by the option's <a href="qstyleoption.html#rect-var">rect</a> variable, using the option's
<a href="qstyleoption.html#state-var">state</a> variable to
determine the state of the item to be displayed, and adjust the way
it is painted accordingly.</p>
<p>For example, a selected item may need to be displayed
differently to unselected items, as shown in the following
code:</p>
<pre class="cpp">
     <span class="keyword">if</span> (option<span class="operator">.</span>state <span class="operator">&amp;</span> <span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">.</span>State_Selected)
         painter<span class="operator">-</span><span class="operator">&gt;</span>fillRect(option<span class="operator">.</span>rect<span class="operator">,</span> option<span class="operator">.</span>palette<span class="operator">.</span>highlight());

     <span class="type">int</span> size <span class="operator">=</span> <a href="qtcore.html#qMin">qMin</a>(option<span class="operator">.</span>rect<span class="operator">.</span>width()<span class="operator">,</span> option<span class="operator">.</span>rect<span class="operator">.</span>height());
     <span class="type">int</span> brightness <span class="operator">=</span> index<span class="operator">.</span>model()<span class="operator">-</span><span class="operator">&gt;</span>data(index<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>DisplayRole)<span class="operator">.</span>toInt();
     <span class="type">double</span> radius <span class="operator">=</span> (size<span class="operator">/</span><span class="number">2.0</span>) <span class="operator">-</span> (brightness<span class="operator">/</span><span class="number">255.0</span> <span class="operator">*</span> size<span class="operator">/</span><span class="number">2.0</span>);
     <span class="keyword">if</span> (radius <span class="operator">=</span><span class="operator">=</span> <span class="number">0.0</span>)
         <span class="keyword">return</span>;

     painter<span class="operator">-</span><span class="operator">&gt;</span>save();
     painter<span class="operator">-</span><span class="operator">&gt;</span>setRenderHint(<span class="type"><a href="qpainter.html">QPainter</a></span><span class="operator">.</span>Antialiasing<span class="operator">,</span> <span class="keyword">true</span>);
     painter<span class="operator">-</span><span class="operator">&gt;</span>setPen(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>NoPen);
     <span class="keyword">if</span> (option<span class="operator">.</span>state <span class="operator">&amp;</span> <span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">.</span>State_Selected)
         painter<span class="operator">-</span><span class="operator">&gt;</span>setBrush(option<span class="operator">.</span>palette<span class="operator">.</span>highlightedText());
     <span class="keyword">else</span>
     ...
</pre>
<p>After painting, you should ensure that the painter is returned
to its the state it was supplied in when this function was called.
For example, it may be useful to call <a href="qpainter.html#save">QPainter.save</a>() before painting and
<a href="qpainter.html#restore">QPainter.restore</a>()
afterwards.</p>
<p><b>See also</b> <a href="qstyle.html#StateFlag-enum">QStyle.State</a>.</p>


<h3 class="fn"><a name="setClipping" />QItemDelegate.setClipping (<i>self</i>, bool&#160;<i>clip</i>)</h3><h3 class="fn"><a name="setEditorData" />QItemDelegate.setEditorData (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>editor</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemdelegate.html#setEditorData">QAbstractItemDelegate.setEditorData</a>().</p>
<p>Sets the data to be displayed and edited by the <i>editor</i>
from the data model item specified by the model <i>index</i>.</p>
<p>The default implementation stores the data in the <i>editor</i>
widget's <a href="properties.html#qt-s-property-system">user
property</a>.</p>
<p><b>See also</b> <a href="qmetaproperty.html#isUser">QMetaProperty.isUser</a>().</p>


<h3 class="fn"><a name="setItemEditorFactory" />QItemDelegate.setItemEditorFactory (<i>self</i>, <a href="qitemeditorfactory.html">QItemEditorFactory</a>&#160;<i>factory</i>)</h3><p>Sets the editor factory to be used by the item delegate to be
the <i>factory</i> specified. If no editor factory is set, the item
delegate will use the default editor factory.</p>
<p><b>See also</b> <a href="qitemdelegate.html#itemEditorFactory">itemEditorFactory</a>().</p>


<h3 class="fn"><a name="setModelData" />QItemDelegate.setModelData (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>editor</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>&#160;<i>model</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemdelegate.html#setModelData">QAbstractItemDelegate.setModelData</a>().</p>
<p>Gets data from the <i>editor</i> widget and stores it in the
specified <i>model</i> at the item <i>index</i>.</p>
<p>The default implementation gets the value to be stored in the
data model from the <i>editor</i> widget's <a href="properties.html#qt-s-property-system">user property</a>.</p>
<p><b>See also</b> <a href="qmetaproperty.html#isUser">QMetaProperty.isUser</a>().</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QItemDelegate.sizeHint (<i>self</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemdelegate.html#sizeHint">QAbstractItemDelegate.sizeHint</a>().</p>
<p>Returns the size needed by the delegate to display the item
specified by <i>index</i>, taking into account the style
information provided by <i>option</i>.</p>
<p>When reimplementing this function, note that in case of text
items, <a href="qitemdelegate.html">QItemDelegate</a> adds a margin
(i.e. 2 * <a href="qstyle.html#PixelMetric-enum">QStyle.PM_FocusFrameHMargin</a>) to
the length of the text.</p>


<h3 class="fn"><a name="updateEditorGeometry" />QItemDelegate.updateEditorGeometry (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>editor</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemdelegate.html#updateEditorGeometry">QAbstractItemDelegate.updateEditorGeometry</a>().</p>
<p>Updates the <i>editor</i> for the item specified by <i>index</i>
according to the style <i>option</i> given.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>